#include <stdio.h>
#include <stdbool.h>

bool search(const int a[], int n, int key);

int main(void)
{
    int n = 5;
    int a[5] = {1, 2, 5, 8, 9};
    bool result;
    int key = 5;

    result = search(a, n, key);

    if (result)
        printf("The number %d exists", key);
}

bool search(const int a[], int n, int key)
{
    const int *p;

    for (p = a; p < a + n - 1; p++)
    {
        if (*p == key)
            return true;
    }

    return false;
}